package top.lyc829.iot_android.http.service;

import android.content.Intent;

import com.xuexiang.xhttp2.model.ApiResult;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import top.lyc829.iot_android.entity.Finger;
import top.lyc829.iot_android.entity.Log;
import top.lyc829.iot_android.entity.User;

/**
 * @Author lyc
 * @create 2021-06-18 14:38
 */
public interface UserService {

    @POST("/user/login/")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Observable<ApiResult> doLogin(@Body User user);

    @GET("/user/friends")
    Observable<ApiResult<List<User>>> getFriends();

    @GET("/user/fingers")
    Observable<ApiResult<List<Finger>>> getFingers(@Query("id") int id);

    @POST("/user/fingers/update")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Observable<ApiResult> updateFinger(@Body Finger finger);

    @POST("/user/fingers/delete")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Observable<ApiResult> deleteFinger(@Body Finger finger);

    @POST("/user/fingers/add")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Observable<ApiResult> addFinger(@Body Finger finger);

    @GET("/user/nfcs")
    Observable<ApiResult<User>> getNfcs(@Query("id") int id);

    @POST("/user/nfcs/delete")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Observable<ApiResult> deleteNfc(@Body User user);

    @POST("/user/nfcs/add")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Observable<ApiResult> addNfc(@Body Integer id);

    @POST("/index/open")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Observable<ApiResult> openDoor(@Body Integer id);

}
